﻿@page "/BaseData/Works/Create"
@using WTM.ViewModel.BaseData.WorksVMs;
@inherits BasePage

<ValidateForm @ref="vform" Model="@Model" OnValidSubmit="@Submit">
    <Row ItemsPerRow="ItemsPerRow.Two" RowType="RowType.Normal">

            <BootstrapInput @bind-Value="@Model.Entity.work"  />
            <Select @bind-Value="@Model.Entity.Dwqy"  PlaceHolder="@WtmBlazor.Localizer["Sys.PleaseSelect"]"/>
            <BootstrapInput @bind-Value="@Model.Entity.Dwmc"  />
            <BootstrapInput @bind-Value="@Model.Entity.Dwbm"  />
            <Select @bind-Value="@Model.Entity.Dwlx"  PlaceHolder="@WtmBlazor.Localizer["Sys.PleaseSelect"]"/>
            <BootstrapInput @bind-Value="@Model.Entity.Dwdz"  />
            <BootstrapInput @bind-Value="@Model.Entity.Lxdh"  />
            <BootstrapInput @bind-Value="@Model.Entity.Lxr"  />
            <WTUploadImage @bind-Value="@Model.Entity.PhotoId"  />
            <BootstrapInput @bind-Value="@Model.Entity.WorkNr"  />
            <BootstrapInputNumber @bind-Value="@Model.Entity.NlYq_1"  />
            <BootstrapInputNumber @bind-Value="@Model.Entity.NlYq_2"  />
            <Select @bind-Value="@Model.Entity.XbYq"  PlaceHolder="@WtmBlazor.Localizer["Sys.PleaseSelect"]"/>
            <BootstrapInput @bind-Value="@Model.Entity.WorkYq_1"  />
            <BootstrapInput @bind-Value="@Model.Entity.WorkYq_2"  />
            <BootstrapInput @bind-Value="@Model.Entity.Xzdy"  />
            <BootstrapInput @bind-Value="@Model.Entity.Remark"  />
    </Row>
    <div class="modal-footer table-modal-footer">
        <Button Color="Color.Secondary" Icon="fa fa-close" Text="@WtmBlazor.Localizer["Sys.Close"]" OnClick="OnClose" />
        <Button Color="Color.Primary" ButtonType="ButtonType.Submit" Icon="fa fa-save" Text="@WtmBlazor.Localizer["Sys.Create"]" IsAsync="true" />
    </div>
</ValidateForm>

@code {

    private WorksVM Model = new WorksVM();
    private ValidateForm vform { get; set; }


    protected override async Task OnInitializedAsync()
    {

        await base.OnInitializedAsync();
    }


    private async Task Submit(EditContext context)
    {
        await PostsForm(vform, "/api/Works/add", (s) => "Sys.OprationSuccess");
    }

    public void OnClose()
    {
        CloseDialog();
    }

}
